﻿<Window x:Class="ListOfTale.KeyForm"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Ключевые слова" Height="300" Width="300" xmlns:my="clr-namespace:ListOfTale" Loaded="Window_Loaded">
    <Window.Resources>
        <my:TalesDataSet x:Key="talesDataSet" />
        <CollectionViewSource x:Key="keysViewSource" Source="{Binding Path=Keys, Source={StaticResource talesDataSet}}" />
    </Window.Resources>
    <Grid DataContext="{StaticResource keysViewSource}">
        <Grid.RowDefinitions>
            <RowDefinition Height="100*">
                
            </RowDefinition>
            <RowDefinition Height="50"/>
        </Grid.RowDefinitions>
        <DataGrid AutoGenerateColumns="False" EnableRowVirtualization="True"  HorizontalAlignment="Stretch" ItemsSource="{Binding Path=Keys, Source={StaticResource talesDataSet}, Mode=TwoWay}" 
                  Name="keysDataGrid" RowDetailsVisibilityMode="VisibleWhenSelected" VerticalAlignment="Stretch" >
            <DataGrid.Columns>
                <DataGridTextColumn x:Name="nameColumn" Binding="{Binding Path=Name,Mode=TwoWay}" Header="Ключевое слово" Width="SizeToHeader" />
                <DataGridTextColumn x:Name="IdKeyColumn" Binding="{Binding Path=IdKey,Mode=TwoWay}" Header="Идентификатор" Width="SizeToHeader" />
            </DataGrid.Columns>
        </DataGrid>
        <Grid Grid.Row="1">
            <Button HorizontalAlignment="Left" Click="Button_Click" Height="23">
                Сохранить
            </Button>
            <Button HorizontalAlignment="Right" Click="Button_Click_1" Height="23">
                Отмена
            </Button>
        </Grid>
    </Grid>
</Window>
